<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创建对象</title>
		<script>
			//创建一个人对象         方法一  构造函数
			var people = new Object();//创建对象
			people.name = "小红帽",
			people.sex = "wawa",
			people.show= function(){
				alert("你好，我是"+this.name + "我还是"+this.sex);
			},
			people.show();//调用方法
			
			//            方法二 字面量
			var people = {
			   name:"小红帽",
			   sex:"娃娃",
			   show:function(){
			   alert(alert("你好，我是"+this.name + "我还是"+this.sex););
			   };
			}
			people.show();//调用方法
			
		</script>
	</head>
	<body>
	</body>
</html>
